<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" >
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>TODO supply a title</title>

        <style type="text/css">
            table.voucherGrid{
                border:1px solid #e2e2e2;
                border-collapse:collapse;
            }
            table.voucherGrid td{
                border:1px solid #e2e2e2;
            }

            table.checkGrid{
                border:1px solid #e2e2e2;
                border-collapse:collapse;
            }
            table.checkGrid td{
                border:1px solid #e2e2e2;
            }

            table.feeGrid{
                border:1px solid #e2e2e2;
                border-collapse:collapse;
            }
            table.feeGrid td{
                border:1px solid #e2e2e2;
            }
            .demo_fieldset {
                margin : 20px;
                border : 1px solid #ACBECE;
            }

            .demo_legend {
                font-weight : bold;
                margin : 0px 10px 0px 18px;
                font-family: Verdana;
            }
            .inputstype{
                width: 175px !important;
            }
            .pic{
                margin-bottom: -4px;
                margin-right: -2px;
                border:none;
                width:20px;
                height:20px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id="emp">
            <rich:panel header="报销凭单支付" styleClass="content-hight">
                <rich:messages globalOnly="true"/>
                <rich:toolbar  itemSeparator="grida">
                    <rich:toolbarGroup>
                        <h:commandLink  action="#{expense.checkPayandRep}"
                                        disabled="#{expense.exp.numberStatus !='2'}">
                            <h:graphicImage value="./images/pay.png" styleClass="pic" title="支付" />
                        </h:commandLink>

                        <h:commandLink  action="#{expense.payrescind}"
                                        disabled="#{expense.exp.numberStatus == '2'
                                                    ||expense.exp.numberStatus == '0'
                                                    ||expense.exp.numberStatus == '3'}">
                            <h:graphicImage value="./images/chexiao.png" styleClass="pic" title="撤销" />
                        </h:commandLink>
                        <a4j:commandLink  execute="@this" render="emp" action="#{expense.getFirst}"
                                          disabled="#{expense.dis.first}">
                            <h:graphicImage value="./images/btn_page_first.gif" styleClass="pic" title="首张" />
                        </a4j:commandLink>
                        <a4j:commandLink  execute="@this" render="emp" action="#{expense.previouse}"
                                          disabled="#{expense.dis.previouse}">
                            <h:graphicImage value="./images/btn_page_up.gif" styleClass="pic" title="上张" />
                        </a4j:commandLink>
                        <a4j:commandLink  execute="@this" render="emp" action="#{expense.next}"
                                          disabled="#{expense.dis.next}">
                            <h:graphicImage value="./images/btn_page_down.gif" styleClass="pic" title="下张" />
                        </a4j:commandLink>
                        <a4j:commandLink  execute="@this" render="emp" action="#{expense.getLast}"
                                          disabled="#{expense.dis.last}">
                            <h:graphicImage value="./images/btn_page_end.gif" styleClass="pic" title="末张" />
                        </a4j:commandLink>
                        <h:commandLink  action="#{expense.goBackPayList}" >
                            <h:graphicImage value="./images/goback.png" styleClass="pic" title="返回" />
                        </h:commandLink>
                    </rich:toolbarGroup>
                </rich:toolbar>
                <fieldset class="demo_fieldset">
                    <legend class="demo_legend">报销单</legend>                   

                    <h:panelGrid columns="6" width="100%" border="0" id="oldexpenseinfo" styleClass="voucherGrid" style="text-align:left">
                        <h:outputLabel value="单据编号:" />
                        <h:outputText  id="number" value="#{expense.exp.number}"  />
                        <h:outputLabel value="单据日期:" />
                        <h:outputText value="#{expense.exp.numDate}">
                            <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                        </h:outputText> 

                        <h:outputLabel value="报销内容:"  />
                        <h:outputText  id="affair" value="#{expense.exp.affair}" />

                        <h:outputLabel value="预算项目名称:" />
                        <h:outputText  id="projName" value="#{expense.exp.project.finName}"/>

                        <h:outputLabel value="费用承担部门:" />
                        <h:outputText  id="paydept" value="#{expense.exp.payDept.name}" />
                        <h:outputLabel value="经手人员:" />
                        <h:outputText  id="feePerson"  value="#{expense.exp.feePer.cpsn_name}"  />

                        <h:outputLabel value="附件张数:"/>
                        <h:outputText value="#{expense.exp.affixAmount}" />

                        <h:outputLabel value="支付方式: "/>
                        <h:outputText value="#{expense.exp.payStyle.name}" />
                        <h:outputLabel value="费用总金额"  />
                        <h:outputText  id="total1" value="#{expense.exp.total}" >
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:outputText>

                        <h:outputLabel value="部门名称:" />
                        <h:outputText  id="department" value="#{expense.exp.dept.name}"  />
                        <h:outputLabel value="制单人:" />
                        <h:outputText  id="cpsn_name"  value="#{expense.exp.user.cpsn_name}"  />
                    </h:panelGrid>
                    <rich:dataTable value="#{expense.expacc}" var="expacclist" id="expacclisttable" style=" width: 100%;" >
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="费用项目"/>
                            </h:panelGroup>
                        </f:facet>
                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="行号"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText  style="width:40px" value="#{expacclist.lineid}"/>
                        </rich:column>
                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="费用项目编号"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{expacclist.costitems.code}" style="width:140px" />
                        </rich:column>
                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="名称"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{expacclist.costitems.name}" style="width:160px"/>
                        </rich:column>
                        <rich:column style=" text-align:  center;">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="报销金额"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{expacclist.expenseaccount}" style="width:160px">
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:outputText>
                        </rich:column>
                    </rich:dataTable>               
                </fieldset>
                <fieldset class="demo_fieldset">
                    <legend class="demo_legend">报销单审核</legend>

                    <h:panelGrid columns="6" width="100%" styleClass="checkGrid" style="text-align:left">
                        <h:outputText value="预算来源："  />
                        <h:outputText value="#{expense.exp.budgetSource}"/>

                        <h:outputText value="支出类别:" />
                        <h:outputText value="基本支出" rendered="#{expense.exp.costClass == '0'}"/>
                        <h:outputText value="项目支出" rendered="#{expense.exp.costClass == '1'}"/>

                        <h:outputLabel value="经济分类:"  />
                        <h:outputText  id="costname" value="#{expense.exp.costitem.name}" />

                        <h:outputLabel value="支付令:" />
                        <h:outputText  id="paycode" value="#{expense.exp.paycode}" />

                        <h:outputText value="支出渠道:" />
                        <h:outputText value="#{expense.exp.costTypes.name}"/>

                        <h:outputLabel value="核定金额:"  />
                        <h:outputText  id="totalnew" value="#{expense.exp.checkaccount}" >
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:outputText>

                        <h:outputLabel value="审核人" />
                        <h:outputText  id="auditor" value="#{expense.exp.auditor}"  />

                        <h:outputLabel value="审核日期:" />
                        <h:outputText value="#{expense.exp.auditDate}">
                            <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                        </h:outputText>
                    </h:panelGrid>
                </fieldset>
                <fieldset class="demo_fieldset">
                    <legend class="demo_legend">报销单支付</legend>

                    <h:panelGrid columns="4" width="100%" border="0" id="payform" style="text-align:left">
                        <h:outputLabel value="支付方式: "/>
                        <h:selectOneMenu value="#{expense.exp.payStyle.code}"
                                         valueChangeListener="#{expense.payWayChange}"
                                         style=" width: 198px;"
                                         disabled="#{expense.exp.numberStatus !='2'}">
                            <f:selectItem itemValue=" " itemLabel="-请选择-"/>
                            <f:selectItems value="#{expense.payStyleList}"/>
                            <a4j:ajax event="change" render="payform" listener="#{expense.changeCashPaid}" />
                        </h:selectOneMenu>

                        <h:outputLabel value="支付凭证号:" />
                        <h:panelGroup>
                            <h:panelGroup rendered="#{expense.exp.numberStatus == '2'}">
                                #{expense.exp.number}
                                <h:inputText size="21" value="#{expense.exp.ticketcode}"/>
                            </h:panelGroup>
                            <h:outputLabel value="#{expense.exp.ticketcode}"
                                           style="margin-left: 0px;padding-left: 0px;"
                                           rendered="#{expense.exp.numberStatus != '2'}"/>
                        </h:panelGroup>

                        <h:outputLabel value="支付金额:" />
                        <h:inputText  id="payaccount"   size="28" value="#{expense.exp.payaccount}"
                                      disabled="#{expense.exp.numberStatus !='2'}">
                            <f:convertNumber type="number" pattern="#,##0.00"/>
                        </h:inputText>

                        <h:outputLabel value="冲账金额"/>
                        <h:panelGroup>
                            <h:inputText  id="repayment"  size="28" value="#{expense.exp.repayment}"
                                          converterMessage="请输入正确的数字。" disabled="#{expense.exp.numberStatus !='2'}">
                                <a4j:ajax event="keyup" render="remain" />
                                <f:convertNumber type="number" pattern="#,##0.00"/>
                            </h:inputText>
                            <h:message for="repayment" style="color:red"/>
                        </h:panelGroup>

                        <h:outputLabel value="收款人:" rendered="#{expense.exp.payStyle.type eq '1'}"/>
                        <h:inputText  id="reciveName"   size="28" value="#{expense.exp.receive}"
                                      rendered="#{expense.exp.payStyle.type eq '1'}"
                                      disabled="#{expense.exp.numberStatus !='2'}"/>

                        <h:outputLabel value="出纳:" />
                        <h:inputText  id="payer"   size="28" value="#{expense.exp.payer}" disabled="true" />

                        <h:outputLabel value="支付日期:" />
                        <h:panelGroup>
                            <rich:calendar value="#{expense.exp.payDate}"
                                           locale="zh_CN" disabled="true"
                                           popup="true"
                                           datePattern="yyyy-MM-dd"
                                           showApplyButton="false"
                                           inputClass="inputstype" />
                        </h:panelGroup>
                        <h:outputLabel value="现金付讫:" style="color:red"/>
                        <h:selectOneRadio id="cashPaid"  value="#{expense.exp.cashPaid}"
                                          disabled="#{expense.exp.numberStatus !='2'}">
                            <f:selectItem itemLabel="是" itemValue="1"/>
                            <f:selectItem itemLabel="否" itemValue="0"/>
                        </h:selectOneRadio>

                        <h:outputLabel value="支付完毕:" style="color:red"/>
                        <h:selectOneRadio id="numberStatus"  value="#{expense.exp.numberStatus}"
                                          disabled="#{expense.exp.numberStatus !='2'}">
                            <f:selectItem itemLabel="是" itemValue="6"/>
                            <f:selectItem itemLabel="否" itemValue="4"/>
                        </h:selectOneRadio>
                    </h:panelGrid>
                </fieldset>
            </rich:panel>
        </h:form>
    </h:body>
</html>
